package crack3d.double_notched_specimen;

import math2.MathUtilities;
import crack3d.AbstractDoubleNotchedSpecimenUsingSDAElement;
import fem2.AbstractStructuralCrackDemo;
import fem2.Element;
import fem2.MaterialModel;
import fem2.MeshPart;
import fem2.Model;
import fem2.element.crack_sda.KOSConstantJumpTetrahedraElement;
import fem2.material.cohesive_law.CohesiveLaw;
import fem2.material.cohesive_law.Mode1JirasekExponentialCohesiveLaw;

public class DoubleNotchedSpecimenMesh2KOSConstantJumpTetrahedraElementAndJirasekExponentialCohesiveLaw
		extends AbstractDoubleNotchedSpecimenUsingSDAElement {

	public DoubleNotchedSpecimenMesh2KOSConstantJumpTetrahedraElementAndJirasekExponentialCohesiveLaw() {
		meshFileName = "mesh2-kos-jirasek.msh";
	}

	@Override
	public Element createElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl) {
		return new KOSConstantJumpTetrahedraElement(mp, mm, cl);
	}

	@Override
	public CohesiveLaw createCohesiveLaw(Model m) {
		double ft = 1;
		double Gf = 0.02;
		double Dnn = 1.0;
		double Dmm1 = 1.0;
		double Dmm2 = 1.0;
		return new Mode1JirasekExponentialCohesiveLaw(Gf, ft, Dnn, Dmm1, Dmm2);
	}

	public static void main(String[] args) {
		AbstractStructuralCrackDemo demo = new DoubleNotchedSpecimenMesh2KOSConstantJumpTetrahedraElementAndJirasekExponentialCohesiveLaw();

		// double[] sArray = LinAlgUtilities.createLambdaArray(new double[] {
		// 0.059, 0.001 },
		// new int[] { 1, 10 });
		double[] sArray = MathUtilities.createLambdaArray(new double[] { 0.059, 0.001 },
				new int[] { 1, 40 }); // not converge

		demo.run(sArray);
	}
}
